import {getMenuData, changeOpenKey, toggleCollapsed, onClick} from "./action";
import {changeTabsData} from "./action";

export const mapIndexSider = {

    mapStateToProps (state) {
        return state.menuData;
    },

    mapDispatchToProps (dispatch) {
        return {
            getMenuData: () => {
                dispatch(getMenuData());
            },
            changeOpenKey: (openKey) => {
                dispatch(changeOpenKey(openKey));
            },
            toggleCollapsed: () => {
                dispatch(toggleCollapsed);
            },
            onClick: (key, title) => {
                dispatch(onClick(key, title));
            },
            changeTabsData: (data, activeKey) => {
                dispatch(changeTabsData(data, activeKey));
            }
        }
    }
}


export const mapIndexTabs = {
    mapStateToProps (state) {
        return state.tabsData;
    },
    mapDispatchToProps (dispatch) {
        return {
            changeTabsData: (data, activeKey) => {
                dispatch(changeTabsData(data, activeKey));
            }
        }
    }
}
